Fix enigma, garmin_xt
authorrobertlipe <robertlipe@gmail.com>
Thu, 2 Jan 2014 04:54:06 +0000 (04:54 +0000)
committerrobertlipe <robertlipe@gmail.com>
Thu, 2 Jan 2014 04:54:06 +0000 (04:54 +0000)
gpsbabel/enigma.cc
gpsbabel/garmin_xt.cc

index 036316ed533c4fff4cd979d368ff53582b54877f..30d571e4899ae07751c106909ee99bb39526b3e1 100644 (file)
@@ -111,8 +111,14 @@ data_read(void)
     waypoint* wpt = waypt_new();
     wpt->latitude = enigmaPositionToDec(le_read32(&ewpt.latitude));
     wpt->longitude = enigmaPositionToDec(le_read32(&ewpt.longitude));
-    wpt->shortname = xstrndup(ewpt.shortname, ewpt.shortname_len);
-    wpt->description = xstrndup(ewpt.longname, ewpt.longname_len);
+    char*sn = xstrndup(ewpt.shortname, ewpt.shortname_len);
+    wpt->shortname = sn;
+    xfree(sn);
+
+    char* ds = xstrndup(ewpt.longname, ewpt.longname_len);
+    wpt->description = ds;
+    xfree(ds);
+
     switch (ewpt.waypoint_type) {
     case WTYPE_WAYPOINT:        // 0
     case WTYPE_AIRPORT:         // 1
index f1ee58a757536e79e00056c4604d5236aaa1cc45..4178261a5d747f09b7061db4cde3491046fdaccb 100644 (file)
@@ -268,6 +268,7 @@ format_garmin_xt_proc_strk(void)
     tmp_track->line_color.opacity = 255;
     // update track name
     tmp_track->rte_name = trk_name;
+    xfree(trk_name);
     track_add_head(tmp_track);
 
     // This is the 1st coordinate of the track